Repository navigation
Update build script to use versions from pom if not specified. - #55
Merged
Merged
Conversation
Signed-off-by: kusuma chalasani <kchalasani@ibm.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe build script now preserves explicitly supplied tags but otherwise reads the project version from pom.xml, errors when that lookup fails, and uses the corrected default Quay image repository. Flow diagram for resolving the container image nameflowchart TD
A[Start build_and_push.sh] --> B{IMAGE_NAME supplied?}
B -->|Yes| C[Use supplied IMAGE_NAME]
B -->|No| D{IMAGE_TAG supplied?}
D -->|Yes| E[Use supplied IMAGE_TAG]
D -->|No| F[Read project version from pom.xml]
F --> G{Version found?}
G -->|No| H[Print error and exit]
G -->|Yes| E
E --> I[Build quay.io/kruize/kruize-optimizer:TAG]
C --> J[Build and push IMAGE_NAME]
I --> J
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="build_and_push.sh" line_range="79" />
<code_context>
if [ -z "$IMAGE_NAME" ]; then
- IMAGE_NAME="quay.io/kruize/optimizer:${IMAGE_TAG}"
+ if [ -z "$IMAGE_TAG" ]; then
+ IMAGE_TAG="$(sed -n 's|^ <version>\(.*\)</version>.*|\1|p' pom.xml | head -n 1)"
+ if [ -z "$IMAGE_TAG" ]; then
+ echo "Error: could not read project version from pom.xml" >&2
</code_context>
<issue_to_address>
**Valid POMs fail image builds**
When the project version in pom.xml uses different indentation or spans multiple lines, `sed` leaves `IMAGE_TAG` empty, so the empty-tag check exits before Maven builds the image.
Parse the POM version without requiring fixed indentation or a single-line element.
Also at `build_and_push.sh:80`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and with the default push enabled, this can publish an image under a different repository and a tag parsed from pom.xml; if that destination or version is wrong, consumers may pull the wrong artifact. Reverting the script does not remove an image already pushed, so cleanup or republishing would be needed.
Blocking findings: build_and_push.sh:79
Signed-off-by: kusuma chalasani <kchalasani@ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update build script to use versions from pom if not specified.
And correct the image registry.
Summary by Sourcery
Derive default image tags from the project version and correct the default image repository.
Bug Fixes:
optimizertokruize-optimizer.Enhancements:
pom.xmlas the default image tag when no tag is provided, with an error when the version cannot be resolved.